package create.singleton;

/**
 * @author dali
 * @date 2021-07-06 14:32
 * @Description 静态内部类
 */

public class NeiBu {
    public static void main(String[] args) {
        NeiBu instance1 = getInstance();
        NeiBu instance2 = getInstance();
        System.out.println(instance1 == instance2);//true
    }

    private NeiBu() {}

    private static class getInstanceClass {
        private static final NeiBu INSTANCE = new NeiBu();
    }

    public static NeiBu getInstance() {
        return getInstanceClass.INSTANCE;
    }
}
